<template>
	<view>
		<cu-custom :isBack="true" >
			<block slot="content">
				<view class="custom-title">工作人员信息</view>
			</block>
		</cu-custom>
		<view class="padding-top-48 padding-left-32 padding-right-32">
			<view class="obj-content">
				<view class="obj-input-name">请填写您希望加入的</view>
                <view class="obj-input-name">企业、组织、政府或管理部门的对公数字ID：</view>
				<input class="obj-input" placeholder="请输入对公数字ID" v-model="form.uuid"></input>
				
				<view class="obj-input-name margin-top-48">所属部门：</view>
				<input class="obj-input" placeholder="请输入部门" v-model="form.department"></input>
				
				<view class="obj-input-name margin-top-48">职位(岗位）：</view>
				<input class="obj-input" placeholder="请输入职位" v-model="form.position"></input>
				
				<view class="obj-input-name margin-top-48">真实姓名：</view>
				<input class="obj-input" placeholder="请输入姓名" v-model="form.realname"></input>
				
				<view class="obj-input-name margin-top-48">手机号：</view>
				<input class="obj-input" placeholder="请输入手机号" v-model="form.mobile"></input>
				
				<view class="footer">
					<!-- <view class="text-center" @click="check=!check">
						<image :src="check?'https://txr001.zthj.net/static/img/check.png':'https://txr001.zthj.net/static/img/uncheck.png'" class="uncheck-img-class"></image>
						<text class="show-text">是否直接向绑定的企业上传用能排放数据</text>
					</view> -->
					<view class="flex align-center justify-center">
						<button @click="submit" class="cu-btn bd-btn">提交信息</button>
					</view>
					
				</view>
			</view>
		</view>
	</view>
	
</template>

<script>
	export default {
		data() {
			return {
				check:false,
                form:{
                    uuid: '',
                    department: '',
                    position: '',
                    realname: '',
                    mobile: '',
                }
			}
		},
		onLoad(){
		},
		onShow() {
			
		},
		methods: {
            submit: async function(){
				if (!this.form.uuid) {
					uni.showToast({
						title: '请输入对公数字ID',
						icon: 'none'
					})
					return
				}
				if (!this.form.department) {
					uni.showToast({
						title: '请输入部门',
						icon: 'none'
					})
					return
				}
				if (!this.form.position) {
					uni.showToast({
						title: '请输入职位',
						icon: 'none'
					})
					return
				}
				if (!this.form.realname) {
					uni.showToast({
						title: '请输入姓名',
						icon: 'none'
					})
					return
				}
				let mobilereg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/
				if (!this.form.mobile) {
					uni.showToast({
						title: '请输入手机号',
						icon: 'none'
					})
					return
				} else if (!mobilereg.test(this.form.mobile)) {
					uni.showToast({
						title: '请输入正确的手机号',
						icon: 'none'
					})
					return
				}
				
                let that = this;
                let res = await this.$api.bindStaff(that.form);
                this.$u.toast(res.msg);
                if (res.code == 1) {
                    setTimeout(function(){
                        uni.navigateBack();
                    },1500)
                }
            }
		}
	}
</script>

<style scoped lang="less">
	.obj-content{
		background: #FFFFFF;
		border-radius: 48rpx;
		padding: 48rpx 32rpx;
		.obj-input-name{
			// margin-top: 48rpx;
			font-size: 28rpx;
			font-weight: 500;
			color: #010101;
		}
		.obj-input{
			margin-top: 12rpx;
			padding-left: 24rpx;
			width: 100%;
			height: 80rpx;
			border-radius: 8rpx;
			border: 2rpx solid #D9D9D9;
		}
		.footer{
			padding-top: 96rpx;
			.uncheck-img-class{
				width: 32rpx;
				height: 32rpx;
				vertical-align: middle;
			}
			.show-text{
				font-size: 24rpx;
				font-weight: 400;
				color: #000000;
				// background-color: rgba(255, 63, 63,0.2);
				vertical-align: middle;
				margin-left: 12rpx;
			}
			.bd-btn{
				width: 454rpx;
				height: 88rpx;
				background: #24458E;
				border-radius: 44rpx;
				font-size: 32rpx;
				font-weight: 400;
				color: #FFFFFF;
				margin-top: 32rpx;
			}
		}
		
	}
</style>